﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HeadedControl.cs" company="">
//   
// </copyright>
// <summary>
//   The headed control.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Windows.Forms;
namespace Libium.Controls
{
	/// <summary>
	/// The headed control.
	/// </summary>
	public partial class HeadedControl : BindableUserControl
	{
		protected string _buffer = string.Empty;

		#region Constructors and Destructors

		/// <summary>
		/// Initializes a new instance of the <see cref="HeadedControl"/> class.
		/// </summary>
		public HeadedControl()
		{
			InitializeComponent();
			NameControl.MouseEnter += NameControl_MouseEnter;
			NameControl.DoubleClick += NameControl_DoubleClick;
		}

		void NameControl_MouseEnter(object sender, System.EventArgs e)
		{
			_buffer = Clipboard.GetText();
		}

		void NameControl_DoubleClick(object sender, System.EventArgs e)
		{
			Clipboard.SetText(_buffer);
		}

		#endregion

		#region Public Properties

		/// <summary>
		/// Gets the name view.
		/// </summary>
		public object NameView
		{
			get
			{
				return NameControl;
			}
		}

		#endregion

		private void HeaderPanel_Click(object sender, System.EventArgs e)
		{
			// To allow scroll of owner control
			HeaderPanel.Focus();
		}
	}
}